const {User} = require("../models");
const UserService = {
    // 获取用户信息
    async getUserInfo({userName}){
        return User.findOne({userName});
    },
    // 更新信息
    async updateByUserId({userId,userPwd}){
        const whereOpt = {userId}
        const newUser = {}
        userPwd && Object.assign(newUser,{userPwd})
        const res = await User.updateOne(whereOpt,newUser)
        return res.modifiedCount
    }
}

module.exports={
    UserService
}
